home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / NFSD / CACHE.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  80 lines

  1. /*
  2.  * include/linux/nfsd/cache.h
  3.  *
  4.  * Request reply cache. This was heavily inspired by the
  5.  * implementation in 4.3BSD/4.4BSD.
  6.  *
  7.  * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
  8.  */
  9.  
  10. #ifndef NFSCACHE_H
  11. #define NFSCACHE_H
  12.  
  13. #ifdef __KERNEL__
  14. #include <linux/sched.h>
  15.  
  16. /*
  17.  * Representation of a reply cache entry. The first two members *must*
  18.  * be hash_next and hash_prev.
  19.  */
  20. struct svc_cacherep {
  21.     struct svc_cacherep *    c_hash_next;
  22.     struct svc_cacherep *    c_hash_prev;
  23.     struct svc_cacherep *    c_lru_next;
  24.     struct svc_cacherep *    c_lru_prev;
  25.     unsigned char        c_state,    /* unused, inprog, done */
  26.                 c_type,        /* status, buffer */
  27.                 c_secure : 1;    /* req came from port < 1024 */
  28.     struct in_addr        c_client;
  29.     u32            c_xid;
  30.     u32            c_proc;
  31.     unsigned long        c_timestamp;
  32.     union {
  33.         struct svc_buf    u_buffer;
  34.         u32        u_status;
  35.     }            c_u;
  36. };
  37.  
  38. #define c_replbuf        c_u.u_buffer
  39. #define c_replstat        c_u.u_status
  40.  
  41. /* cache entry states */
  42. enum {
  43.     RC_UNUSED,
  44.     RC_INPROG,
  45.     RC_DONE
  46. };
  47.  
  48. /* return values */
  49. enum {
  50.     RC_DROPIT,
  51.     RC_REPLY,
  52.     RC_DOIT,
  53.     RC_INTR
  54. };
  55.  
  56. /*
  57.  * Cache types.
  58.  * We may want to add more types one day, e.g. for diropres and
  59.  * attrstat replies. Using cache entries with fixed length instead
  60.  * of buffer pointers may be more efficient.
  61.  */
  62. enum {
  63.     RC_NOCACHE,
  64.     RC_REPLSTAT,
  65.     RC_REPLBUFF,
  66. };
  67.  
  68. /*
  69.  * If requests are retransmitted within this interval, they're dropped.
  70.  */
  71. #define RC_DELAY        (HZ/5)
  72.  
  73. void    nfsd_cache_init(void);
  74. void    nfsd_cache_shutdown(void);
  75. int    nfsd_cache_lookup(struct svc_rqst *, int);
  76. void    nfsd_cache_update(struct svc_rqst *, int, u32 *);
  77.  
  78. #endif /* __KERNEL__ */
  79. #endif /* NFSCACHE_H */
  80.